package org.cloud.utils;

import brave.ScopedSpan;
import brave.Tracer;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.longyou.comm.starter.CommonServiceApplication;
import com.unkow.first.telegram.util.TelMsgSendUtil;
import lombok.extern.slf4j.Slf4j;
import org.cloud.feign.utils.FeignUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import zipkin2.internal.Trace;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {CommonServiceApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class TelegramApiSendMsgUtilTest {
    @Test
    public void testSendMsg() {

        String ICO_NOTIC_MESSAGE = "*【认购通知】*\n"
            + "\\- *用户*: %s\n"
            + "\\- *金额*: %s\n"
            + "\\- *数量*: %s\n"
            + "\\- *时间*: %s\n";

        TelMsgSendUtil.single()
            .sendMessage("-1002196932610", String.format(ICO_NOTIC_MESSAGE, "test", "100", "100", "2020\\-01\\-01"), "MarkdownV2");


            String msg = String.format(ICO_NOTIC_MESSAGE, "test", "100", "100", DateUtil.now());
            FeignUtil.single()
                .sendTelMsgMarkdownV2("-1002196932610", msg.replace("-","\\-"));

    }
}